home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource2
/
sclib_1
/
1_6
/
v7n6044b.txt
< prev
next >
Wrap
Text File
|
1995-11-01
|
896b
|
53 lines
#include "math.h"
#include "plot.h"
void settran(theta,phi)
double theta,phi;
{
double ct,cp,st,sp;
ct = cos(theta); st = sin(theta);
cp = cos(phi); sp = sin(phi);
m1 = ct; m2 = st;
m3 = st*sp; m4 = ct*sp; m5 = cp;
}
void initialmask (p,n)
Gpoint *p;
int n;
{
int i;
/*
* Initialize mask and mask size.
*/
for (i=0; i<n; i++) top[i] = bottom[i] = p[i];
topn = bottomn = n;
}
void transform (px,py,pz,p,n)
double *px,*py,*pz;
Gpoint *p;
int n;
{
/*
* Transform the (x,y,z) coordinates to (x",y") coords.
*/
int i;
for (i=0; i<n; i++)
{
p[i].x = px[i]*m1 - py[i]*m2;
p[i].y = px[i]*m3 + py[i]*m4 + pz[i]*m5;
}
}
int copyvec (a,b,n)
Gpoint *a,*b;
int n;
{
int i,k=1;
b[0] = a[0];
for (i=1; i<n; i++)
if (b[i].x != b[i-1].x)
{ b[i] = a[i]; k++; }
return (k);
}